<template>
	<view class="search">
		<navbar></navbar>
		<textNavbar myprops="搜一搜"></textNavbar>
		<van-search
		  :value="value"
		  shape="round"
		  background="#EDEDED"
		  placeholder="请输入"
			@search="confirm"
		/>
		<view class="fore-img">
			<view class="fore-img-vw">
				<view class="fore-img-vw-content" @click="zls">
					<image src="../../../static/白律师.png" mode=""></image>
					<text>找律师</text>
				</view>
				<view class="fore-img-vw-content" @click="zywd">
					<image src="../../../static/问答@1x.png" mode=""></image>
					<text>专业问答</text>
				</view>
				<view class="fore-img-vw-content" @click="flwt">
					<image src="../../../static/黑私问.png" mode=""></image>
					<text>法律问题</text>
				</view>
				<view class="fore-img-vw-content" @click="flzs">
					<image src="../../../static/黑制度.png" mode=""></image>
					<text>法律知识</text>
				</view>
			</view>
		</view>
		<view class="search-sou">
			<view class="search-sou-vw">
				<view class="search-sou-vw-top">
					<text>热门搜索</text>
				</view>
				<view class="search-content" v-for="(item, index) in list" @click="cilckH(item)">
					<text class="text1">{{ index + 1 }}</text>
					<text class="text2">{{ item.name }}</text>
				</view>
			</view>
		</view>
		<fourbar></fourbar>
	</view>
</template>

<script>
	import { search } from '../../../utils/utils'
	export default {
		data() {
			return {
				value: '',
				list: [],
			}
		},
		onLoad() {
			search((res) => {
				// console.log(res);
				this.list = res.data.list
				console.log(this.list);
			})
		},
		methods: {
			// 热门搜索跳转
			cilckH(i) {
				console.log(i.name);
				uni.navigateTo({
					url:`/pages/Attorney side/searchResult/searchResult?value=${i.name}`
				})
			},
			// 跳转到搜索结果页
			confirm (e) {
				uni.navigateTo({
					url:`/pages/Attorney side/searchResult/searchResult?value=${e.detail}`
				})
			},
			// 找律师
			zls () {
				uni.navigateTo({
					url: "/pages/lawyer/lawyer"
				})
			},
			// 专业问答
			zywd () {
				uni.navigateTo({
					url: "/pages/Attorney side/zywdPage/zywdPage"
				})
			},
			// 法律问题
			flwt () {
				uni.navigateTo({
					url: "/pages/Attorney side/lsjdPage/lsjdPage"
				})
			},
			// 法律知识
			flzs () {
				uni.navigateTo({
					url: "/pages/Attorney side/flzsPage/flzsPage"
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.search {
		width: 100vw;
		height: 100vh;
		background-color: #EDEDED;
	}
	
	.fore-img {
		width: 100vw;
		height: 110px;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.fore-img-vw {
		width: 275px;
		height: 75px;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
	.fore-img-vw-content {
		width: 52px;
		height: 75px;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: space-between;
		font-size: 13px;
	}
	
	.fore-img-vw-content > image {
		width: 50px;
		height: 50px;
	}
	
	.search-sou {
		width: 100vw;
		height: 405px;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.search-sou-vw {
		width: 92vw;
		height: 405px;
		border-radius: 8px;
		background-color: white;
	}
	
	.search-sou-vw-top {
		height: 30px;
	}
	.search-sou-vw-top > text {
		width: 100%;
		height: 100%;
		font-size: 14px;
		font-weight: bold;
		margin-left: 15px;
		line-height: 30px;
	}
	
	.search-content {
		height: 25px;
		font-size: 14px;
		line-height: 25px;
	}
	.search-content > .text1 {
		color: #a3aec7;
		margin: 0 5px 0 20px;
	}
	.search-content > .text2 {
		color: black;
	}
</style>
